<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ include file="/WEB-INF/jsp/header.jsp" %>


<%@ include file="/WEB-INF/jsp/partnerTools.jsp" %>

<H2>Currency exchange rates </H2>

<h3> Last update: <c:out value="${updateTime}"/> ago </h3>


<br/>

<table class="searchTable">
	<form:form method="POST" commandName="currencySearchCriteria">

	<tr>	
		<td>
			Select sort criteria:
		</td>
		<td>
			<form:select path="sortCriteria">
				<form:options  itemLabel="name" />
			</form:select>
		</td>
		
	</tr>
	
	<tr>
		<td colspan="2">
			<center><input type="submit" value="Show"></center>
		</td>
	</tr>
	</form:form>
	
</table>



<%@ include file="/WEB-INF/jsp/commercials.jsp" %>



<table width="800" border="2" cellpadding="2" cellspacing="0" bordercolor="777777" width="600" style="text-align: center; font-size: 11px">

	<tr> 
		<td> Country</td> 
		<td> gold price </td> 
		<td> currency price </td> 
		<td> exchange rate history </td> 
		<td> spread</td> 
		<td> population </td> 
	</tr>
		
	<c:forEach var="data" items="${countryData}" >
			<tr style="background: none repeat scroll 0% 0% rgb(242, 243, 202);">
					<td> 
					<img src="<c:out value="${data.location.url}"/>"/><br/>
					<c:out value="${data.location.name}"/>
					<c:if test="${data.location.type == 'Country'}">
						(<c:out value="${data.country.alliance.name}"/>)
					</c:if>
				</td>

				
				<td> 
					<c:set var="goldPrice"><fmt:formatNumber value="${data.currencyForGold}" maxFractionDigits="4"/></c:set>
					<c:set var="currencyPrice"><fmt:formatNumber value="${data.goldForCurrency}" maxFractionDigits="4"/></c:set>
					<c:set var="spread"><fmt:formatNumber value="${data.spread}" maxFractionDigits="2"/></c:set>
					1 <c:out value="${data.country.currencyName}"/> = <c:out value="${currencyPrice}"/><img src="http://34all.org/erep/gold.gif"/>
				</td>
				
				<td> 				
					1 <img src="http://34all.org/erep/gold.gif"/> = <c:out value="${goldPrice}"/> <c:out value="${data.country.currencyName}"/>
				</td>
				
				<td> 	
				
					<a href="currencyChart.html?country=<c:out value="${data.location}"/>">view charts</a>
				
				</td>
				
				<td> 
					<c:out value="${spread}"/>%
				</td>
	
				<td> 
					<c:out value="${data.population}"/><br/>
				</td>
				
				
			</tr>
	</c:forEach>
		
		
</table>



<%@ include file="/WEB-INF/jsp/bottom.jsp" %>

